The BLAST computer program presently uses computer simulations to give accurate estimates of statistical significance for sequence matches. Recent advances in the statistical theory of gapped sequence alignments indicates a need for further rigorous mathematical results in the underlying statistical theory. This project aims to provide those results. In particular, I have developed as mathematical proofs the limiting evolution of the composition of high scoring segments as a Brownian motion, a result that can be used to improve the accuracy of approximations to the statistics of gapped alignments. In addition, the edge effects present because real sequences have limited lengths appear as a correction term in an asymptotic expansion of the probability of sequence matching. This edge effect is likely to be more important in the statistics of matching with gaps than it was in the statistics of matching without gaps, because gapped matches tend to be longer, exhausting the sequences being matched more easily. As a byproduct, this project has produced some new analytic results that are likely to be useful in detecting non-random positioning of genomic markers. These analytic results follow from continuous-time analogs for the discrete-time results for random sums.